<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>JPetStore</title>
    <link rel="stylesheet" href="../css/jpetstore.css" type="text/css"/>
    <link rel="stylesheet" href="../css/jquery-ui.css" type="text/css"/>
    <script th:src = "@{/JS/jquery-3.2.1.js}"></script>
    <script th:src = "@{/JS/jquery-ui.js}"></script>
</head>
<body>
    <div th:replace="/common/header.html"></div>
    <div id="Content">
        <div id="BackLink">
            <a th:href="@{'viewProduct?productId='+${product.getProductId()}}" th:text="'Return to '+${product.productId}"></a>
        </div>

        <div id="Catalog">

            <table>
                <tr>
                    <td><img th:src="${product.getImages()}" style="width: 100px;height: 100px"></td>
                </tr>
                <tr>
                    <td th:text ="${product.getDescription()}"></td>
                </tr>
                <tr>
                    <td><b th:text="${item.getItemId()}"></b></td>
                </tr>
                <tr>
                    <td><b th:text="${item.getAttribute1()+item.getAttribute2+
                                   item.getAttribute3()+item.getAttribute4()+item.getAttribute5()+
                                   product.getName()}">
                    </b></td>
                </tr>
                <tr>
                    <td th:text="${product.getName()}"></td>
                </tr>

                <tr>
                    <td th:text="${item.getSupplierId() <= 0  || item.getStatus() eq 'NP'}?'':${item.getSupplierId()}+' in stock'"></td>
                </tr>

                <tr>
                    <td th:text="'$'+${#numbers.formatDecimal(item.getListPrice(),1,'COMMA',2,'POINT')}"></td>
                </tr>

                <tr th:if="${item.getSupplierId() > 0 && item.getStatus() eq 'P'}">
                    <td th:if="${session.loginAccount ne null}">
                        <a class="Button" th:href="@{'/cart/addItemToCart?workingItemId='+${item.getItemId()}}">Add to Cart</a>
                    </td>

                    <td th:if="${session.loginAccount eq null}">
                        <a class="Button" th:href="@{/account/signOnForm}">Add to Cart</a>
                    </td>
                </tr>
                <tr th:if="${item.getSupplierId() <= 0 || item.getStatus() eq 'NP'}">
                    <td id="ItemSale">商品已经售完或者下架</td>
                </tr>
            </table>

        </div>
    </div>
    <div th:replace="/common/footer.html"></div>
</body>
</html>